package cn.iocoder.yudao.module.crossborder.order.dal.mysql.ordercustomeraddress;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.ordercustomeraddress.OrderCustomerAddressDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.ordercustomeraddress.vo.*;

/**
 * 跨境电商客户地址 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderCustomerAddressMapper extends BaseMapperX<OrderCustomerAddressDO> {

    default PageResult<OrderCustomerAddressDO> selectPage(OrderCustomerAddressPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderCustomerAddressDO>()
                .eqIfPresent(OrderCustomerAddressDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(OrderCustomerAddressDO::getAddressType, reqVO.getAddressType())
                .likeIfPresent(OrderCustomerAddressDO::getAddressName, reqVO.getAddressName())
                .likeIfPresent(OrderCustomerAddressDO::getFirstName, reqVO.getFirstName())
                .likeIfPresent(OrderCustomerAddressDO::getLastName, reqVO.getLastName())
                .likeIfPresent(OrderCustomerAddressDO::getFullName, reqVO.getFullName())
                .eqIfPresent(OrderCustomerAddressDO::getCompany, reqVO.getCompany())
                .eqIfPresent(OrderCustomerAddressDO::getPhone, reqVO.getPhone())
                .eqIfPresent(OrderCustomerAddressDO::getEmail, reqVO.getEmail())
                .eqIfPresent(OrderCustomerAddressDO::getCountryCode, reqVO.getCountryCode())
                .likeIfPresent(OrderCustomerAddressDO::getCountryName, reqVO.getCountryName())
                .eqIfPresent(OrderCustomerAddressDO::getProvince, reqVO.getProvince())
                .eqIfPresent(OrderCustomerAddressDO::getCity, reqVO.getCity())
                .eqIfPresent(OrderCustomerAddressDO::getDistrict, reqVO.getDistrict())
                .eqIfPresent(OrderCustomerAddressDO::getAddressLine1, reqVO.getAddressLine1())
                .eqIfPresent(OrderCustomerAddressDO::getAddressLine2, reqVO.getAddressLine2())
                .eqIfPresent(OrderCustomerAddressDO::getPostalCode, reqVO.getPostalCode())
                .eqIfPresent(OrderCustomerAddressDO::getLatitude, reqVO.getLatitude())
                .eqIfPresent(OrderCustomerAddressDO::getLongitude, reqVO.getLongitude())
                .eqIfPresent(OrderCustomerAddressDO::getIsDefault, reqVO.getIsDefault())
                .eqIfPresent(OrderCustomerAddressDO::getIsValidated, reqVO.getIsValidated())
                .eqIfPresent(OrderCustomerAddressDO::getValidationSource, reqVO.getValidationSource())
                .betweenIfPresent(OrderCustomerAddressDO::getValidationTime, reqVO.getValidationTime())
                .eqIfPresent(OrderCustomerAddressDO::getUseCount, reqVO.getUseCount())
                .betweenIfPresent(OrderCustomerAddressDO::getLastUseTime, reqVO.getLastUseTime())
                .betweenIfPresent(OrderCustomerAddressDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderCustomerAddressDO::getId));
    }

}